import time
from multiprocessing import Process
from threading import Thread

#多线程
def job(a):
    time.sleep(0.5)
    print("多进程")
    time.sleep(1)
    print("多线程")

start_time = time.time()
if __name__ == "__main__":
    t_list = []
    for a in range(5):
        t = Thread(target=job, args=(a, ))
        t.start()
        t_list.append(t)

        for t in t_list:
            t.join()
        end_time = time.time()


        print(end_time-start_time)


#多进程
start_time = time.time()
if __name__ == "__main__":
    p_list = []
    for a in range(5):
        p = Process(target=job, args=(a, ))
        p.start()
        p_list.append(p)

        for p in p_list:
            p.join()
        end_time = time.time()
        print(end_time-start_time)

